//
//  KWTParaMeterCell.m
//  RuiHeApp
//
//  Created by Yan Chen on 2024/8/19.
//

#import "KWTParaMeterCell.h"
@interface KWTParaMeterCell()
@property (nonatomic, strong) QMUILabel *titleLab;

@property (nonatomic, strong) QMUILabel *contentLab;

@end
@implementation KWTParaMeterCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
        [self setupUI];
    }
    return self;
}

-(void)setModel:(DeviceChartFieldModel *)model
{
    _model = model;
    self.titleLab.text = [NSString stringWithFormat:@"%@:",model.keyName];
    NSString *content = [NSDecimalNumber decimalStringWithDoubleString:model.content nullStr:@"--"];
    self.contentLab.text = [NSString stringWithFormat:@"%@%@",content,model.unitName];
}

-(void)setupUI
{
    kWeakSelf;
    self.contentView.backgroundColor = CFTabViewBgColor;
    UIView *bgView = [[UIView alloc]init];
    bgView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:bgView];
    self.contentView.backgroundColor = CFTabViewBgColor;
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.insets(UIEdgeInsetsMake(0, 15, 0, 15));
        make.height.offset(40);
    }];
    
    _titleLab = [[QMUILabel alloc]init];
    _titleLab.textColor = [UIColor colorWithHexString:@"3F4443" alpha:0.6];
    _titleLab.textAlignment = NSTextAlignmentLeft;
    _titleLab.font = kSYSTEMFONT(14);
    [bgView addSubview:_titleLab];
    [_titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(15);
        make.centerY.mas_offset(0);
    }];
    
    _contentLab = [[QMUILabel alloc]init];
    _contentLab.textColor = [UIColor colorWithHexString:@"3F4443" alpha:0.8];
    _contentLab.textAlignment = NSTextAlignmentLeft;
    _contentLab.font = kSYSTEMFONT(14);
    [bgView addSubview:_contentLab];
    [_contentLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_offset(-15);
        make.centerY.mas_offset(0);
    }];
    
    
}


@end
